export const generatedColumns = (vm, demo) => {
  return [
    {
      title: "设备名称",
      align: "center",
      key: "deviceName"
    },
    {
      title: "设备ID",
      align: "center",
      key: "deviceNo"
    },
    {
      title: "设备位置",
      align: "center",
      key: "location"
    },
    {
      title: "所属企业",
      align: "center",
      key: "company"
    },
    {
      title: "事件详情",
      align: "center",
      key: "content"
    },
    {
      title: "是否恢复",
      align: "center",
      render: (h, params) => {
        const { status } = params.row;
        if (status === 1) return h("span", "已恢复");
        else if (status === 2) return h("span", "未恢复");
        else h("span", "-");
      }
    },
    {
      title: "事件时间",
      align: "center",
      render: (h, params) => {
        const { happenDate } = params.row;
        return h("span", vm.moment(happenDate).format("YYYY-MM-DD HH:mm:ss"));
      }
    },
    {
      title: "恢复时间",
      align: "center",
      render: (h, params) => {
        const { recoverDate } = params.row;
        if (!recoverDate) return h("span", "-");
        else
          return h(
            "span",
            vm.moment(recoverDate).format("YYYY-MM-DD HH:mm:ss")
          );
      }
    }
  ];
};
